{% extends "commons/base.html" %}
{% block title %}登录{% endblock %}
{% block css %}
<link rel="stylesheet" href="{{url_for('static', filename='css/register.css')}}">
{% endblock %}
{% block content %}
<div class="form-content panel panel-default">
    <div class="panel-heading">用户登录</div>
    <div class="panel-body">
        <form action="{{url_for('user.login', next=next_url)}}" method="post" class="form-horizontal">
            {{form.hidden_tag()}}
            <div class="form-group">
                {{form.account.label(class="col-sm-3 control-label")}}
                <div class="col-sm-6">
                    {{form.account(class="form-control", placeholder="用户名/邮箱")}}
                </div>
                <div class="col-sm-3">
                    {% if get_flashed_messages() and get_flashed_messages()[0].account and get_flashed_messages()[0].account[0] %}
                        <p class="form-control-static text-danger">
                            {{get_flashed_messages()[0].account[0]}}
                        </p>
                    {% endif %}
                </div>
            </div>
            <div class="form-group">
                {{form.password.label(class="col-sm-3 control-label")}}
                <div class="col-sm-6">
                    {{form.password(class="form-control")}}
                </div>
                <div class="col-sm-3">
                    {% if get_flashed_messages() and get_flashed_messages()[0].password and get_flashed_messages()[0].password[0] %}
                        <p class="form-control-static text-danger">
                            {{get_flashed_messages()[0].password[0]}}
                        </p>
                    {% endif %}
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-4 checkbox col-sm-offset-3">
                    <label for="">
                        {{form.remember_me()}} 记住我
                    </label>
                    {% if get_flashed_messages() and get_flashed_messages()[0].error %}
                        <p class="form-control-static text-danger">
                            {{get_flashed_messages()[0].error}}
                        </p>
                    {% endif %}
                </div>
                <div class="col-sm-5">
                    <p class="form-control-static">
                        <a href="">忘记密码？</a>
                        <a href="{{url_for('user.register')}}">注册新用户</a>
                    </p>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-6 col-sm-offset-3">
                    {{form.submit(class="btn btn-primary")}}
                </div>
            </div>
        </form>
    </div>
</div>
{% endblock %}